<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	template="/templates/default.xhtml">
	<ui:define name="content">

		<h1>Class List</h1>
		
		<h:form id="class">
			<div class="box-body">
				<div class="form-group">
					<h:dataTable value="#{classesController.classes}" var="_class"
						styleClass="table table-bordered">
						<h:column>
							<f:facet name="header">Id</f:facet>
							<div class="center">#{_class.id}</div>
						</h:column>
						<h:column>
							<f:facet name="header">Name</f:facet>
							<h:commandLink value="#{_class.name}"
								action="#{classesController.edit}">
								<f:param name="selectedId" value="#{_class.id}" />
							</h:commandLink>
						</h:column>
						<h:column>
							<f:facet name="header">Start Date</f:facet>
							#{_class.startDate}
						</h:column>
						<h:column>
							<f:facet name="header">End Date</f:facet>
							#{_class.endDate}
						</h:column>
						<h:column>
							<f:facet name="header">Semester</f:facet>
							#{_class.semester.name}
						</h:column>
						<h:column>
							<f:facet name="header">Subject</f:facet>
							#{_class.subject.name}
						</h:column>
						<h:column>
							<f:facet name="header">Max Students</f:facet>
							#{_class.maxStudents}
						</h:column>
						<h:column>
							<f:facet name="header">Enroll</f:facet>
							<div class="center">
								<h:commandLink action="#{classesController.enroll}">
									<i class="glyphicon glyphicon-check"></i>
									<f:param name="selectedId" value="#{_class.id}" />
								</h:commandLink>
							</div>
						</h:column>
						<h:column>
							<f:facet name="header">Delete</f:facet>
							<div class="center">
								<h:commandLink action="#{classesController.doDelete}">
									<i class="glyphicon glyphicon-remove"></i>
	                        		<f:param name="selectedId" value="#{_class.id}"/>
	                        	</h:commandLink>
                        	</div>
						</h:column>
					</h:dataTable>
				</div>
			</div>
			<div class="box-footer">
				<h:commandButton action="#{classesController.create}" value="New Class" styleClass="btn btn-primary"/>
			</div>
		</h:form>
		
	</ui:define>
</ui:composition>